<template>
	<view>
		<view class="bottomas">
		<u-tabbar
			:value="value4"
			@change="changeTabbar"
			:fixed="true"
			:placeholder="true"
			activeColor="#6EC5FF"	
			:safeAreaInsetBottom="false"
			zIndex="999"
			:ZnOpenTabbar="ZnOpenTabbar"
		>
			<u-tabbar-item text="尊享服务" v-if="vipStatus">
				<image
					class="tab3"
					slot="active-icon"
					src="../../static/img/tab3.png"
				></image>
				<image
					class="tab3"
					slot="inactive-icon"
					src="../../static/img/tab33.png"
				></image>
			</u-tabbar-item>
			<u-tabbar-item text="首页" v-if="vipStatus">
				<image
					class="tab2"
					slot="active-icon"
					src="../../static/img/tab2.png"
				></image>
				<image
					class="tab2"
					slot="inactive-icon"
					src="../../static/img/tab22.png"
				></image>
			</u-tabbar-item>
			<u-tabbar-item text="加入计划" v-if="vipStatus == 1">
				<image
					class="tab1"
					slot="active-icon"
					src="../../static/img/tab1.png"
				></image>
				<image
					class="tab1"
					slot="inactive-icon"
					src="../../static/img/tab11.png"
				></image>
			</u-tabbar-item>
			<u-tabbar-item text="个人中心" v-if="vipStatus == 2">
				<image
					class="tab1"
					slot="active-icon"
					src="../../static/img/tab4.png"
				></image>
				<image
					class="tab1"
					slot="inactive-icon"
					src="../../static/img/tab44.png"
				></image>
			</u-tabbar-item>
		</u-tabbar>
		</view>
	</view>
</template>

<script>
	import HostConfig from '@/utils/host.js';
	import Host from '@/utils/api.js';
	const app = getApp();
	export default{
		name: 'ZnTabbar',
		props:{
			value4:{
				type: [String, Number],
				default: 0
			},
			ZnOpenTabbar:{
				type: Boolean,
				default: false
			},
			vipStatus: {
				type: [String, Number],
				default: 1,
			}
		},
		data(){
			return{
				// vipStatus: getApp().globalData.vipStatus,//判断用户是否为会员
			}
		},
		created()
		{
			console.log(app.globalData.vipStatus)
		},
		mounted() {
		},
		methods:{
			changeTabbar(e){
				console.log(e)
				if(this.vipStatus == 2){
					if(e == 0){
						uni.redirectTo({
						    url: '/pages/zhunxingfuwu/zhunxingfuwu'
						});
					}
					else if(e == 1){
						uni.redirectTo({
						    url: '/pages/index/index'
						});
					}
					else if(e == 2){
						uni.redirectTo({
						    url: '/pages/own/own'
						});
					}
					this.$emit('changeTabbar',e);
					return;
				}
				if(e == 0){
					uni.redirectTo({
					    url: '/pages/zhunxingfuwu/zhunxingfuwu'
					});
				}
				else if(e == 1){
					uni.redirectTo({
					    url: '/pages/index/index'
					});
				}
				else if(e == 2){
					uni.redirectTo({
					    url: '/pages/zhunxingfuwu/jiarujiahua/jiarujiahua'
					});
				}else if(e == 3){
					uni.redirectTo({
					    url: '/pages/own/own'
					});
				}
				this.$emit('changeTabbar',e);
			}
		}
	}
</script>

<style>
	.tab3{
		width: 48upx;
		height: 48upx;
	}
	.tab2{
		width: 50upx;
		height: 48upx;
	}
	.tab1{
		width: 50upx;
		height: 48upx;
	}
</style>
